#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 1e5 + 10;

int R[N], C[N];
int havr, havc, q, n;
vec GR[N], GC[N];
bool ans[N];
int tans[N];
int trur, truc;

set < pii > r, c;

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	n = in;
	rep(i, 1, n) R[i] = in, r.ep(R[i], i);
	rep(i, 1, n) C[i] = in, c.ep(C[i], i);
	q = in; 
	rep(i, 1, q) {
		int x = in, y = in;
		GR[x].eb(i); GC[y].eb(i);
	}
	while(r.size() && c.size()) {
		vec curr, curc;
		if(r.rbegin() -> fi - trur == n - havr || c.rbegin() -> fi - truc == n - havc) {
			//cerr << "!" << endl;
			while(r.size() && r.rbegin() -> fi - trur == n - havr) {
				//cerr << r.rbegin() -> fi << " " << n - havr << " " << r.rbegin() -> se << endl;
				curr.eb(r.rbegin() -> se); r.erase(--r.end());
			}
			while(c.size() && c.rbegin() -> fi - truc == n - havc) {
				curc.eb(c.rbegin() -> se); c.erase(--c.end());
			}
			for(auto v : curr) for(auto id : GR[v]) if(!ans[id]) ans[id] = true, tans[id] = 1;
			for(auto v : curc) for(auto id : GC[v]) if(!ans[id]) ans[id] = true, tans[id] = 1;
			//for(auto v : curr) cerr << "DR : "<< v << endl;
			//for(auto v : curc) cerr << "DC : "<< v << endl;
			havc += curr.size(); havr += curc.size();
			truc += curr.size(); trur += curc.size();
		} else {
			assert(r.begin() -> fi == trur || c.begin() -> fi == truc);
			while(r.size() && r.begin() -> fi == trur) {
				curr.eb(r.begin() -> se); r.erase(r.begin());
			}
			while(c.size() && c.begin() -> fi == truc) {
				curc.eb(c.begin() -> se); c.erase(c.begin());
			}
			for(auto v : curr) for(auto id : GR[v]) if(!ans[id]) ans[id] = true, tans[id] = 0;
			for(auto v : curc) for(auto id : GC[v]) if(!ans[id]) ans[id] = true, tans[id] = 0;
			//for(auto v : curr) cerr << "NR : "<< v << endl;
			//for(auto v : curc) cerr << "NC : "<< v << endl;
			havc += curr.size(); havr += curc.size();
		}
	}
	rep(i, 1, q) printf(tans[i] ? "#" : ".");
	return 0;
}
